<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>继承</title>
</head>
<body>
    <script>
        // 定义Person类
        class Person{
            // 构造方法
            constructor(name,age){
                this.name = name;
                this.age = age;
            }
            // eat方法
            eat(){
                document.write("吃饭...");
            }
        }
        // 定义worker类继承Person
        class Worker extends Person{
            constructor(name,age,salary){
                super(name,age);
                this.salary = salary;
            }

            show(){
                document.write(this.name+","+this.age+","+this.salary+"<br>");

            }
            other(){
                document.write("秀色可餐！")
            }
        }

        // 使用Worker类
        let w = new Worker("高圆圆",28,10000);
        w.show();
        w.eat();
        w.other();

    </script>
</body>
</html>